package com.morningstar.qs.basic.db.constant;


/** the constant of message
 * 
 * @author yusen.liu
 *
 */
public class MessageConstant {

	public static final String FORMATE_DATE_ALL = "yyyy-MM-dd HH:mm:ss";
	public static final String FORMATE_DATE_YMD = "yyyy-MM-dd";
	public static final int MESSAGE_COUNT_FULL = 200;
	public static final int MESSAGE_COUNT_WARNING = 180;
	
	public enum MessageType{
		MESSAGE((short)0),
		SHARE((short)1),
		ALERT((short)2),
		SYSTEM((short)3);
		
		private final short value;
		
		private MessageType(short value){
			this.value = value;
		}
		
		public short getValue(){
			return value;
		}
	}
	
	
	public enum MemberType{
		RECEIVER((short)0),
		SENDER((short)1);

		private final short value;
		
		private MemberType(short value){
			this.value = value;
		}
		
		public short getValue(){
			return this.value;
		}
	}
	
	
	public enum MessageStatus{
		UNREAD((short)0),
		READ((short)1),
		DELETE((short)2);
		
		private final short value;
		
		private MessageStatus(short value){
			this.value = value;
		}
		
		public short getValue(){
			return this.value;
		}
	}
	
	public enum MessageMemberColumn{
		MESSAGE_ID("messageId"),
		MEMBER_USER_ID("memberUserId"),
		MEMBER_TYPE("memberType"),
		MEMBER_ADDRESS("memberAddress"),
		MESSAGE_STATUS("messageStatus"),
		CREATE_TIME("createTime");
		
		private final String value;
		
		private MessageMemberColumn(String value){
			this.value = value;
		}
		
		public String getValue(){
			return this.value;
		}
	}
	
	public enum UserMessageInfoColumn{
		MESSAGE_ID("messageId"),
		MESSAGE_TYPE("messageType"),
		SENDER_ADDRESS("senderAddress"),
		RECEIVER_ADDRESS("receiverAddress"),
		SUBJECT("subject"),
		CONTENT("content"),
		ATTACHMENT("attachment"),
		CREATE_TIME("createTime");
		
		private final String value;
		
		private UserMessageInfoColumn(String value){
			this.value = value;
		}
		
		public String getValue(){
			return this.value;
		}
	}
	
	public enum MessageSort{
		FROM(0),
		RECEIVED(1),
		SUBJECT(2),
		TYPE(3);
		
		private final Integer value;
		
		private MessageSort(Integer value){
			this.value = value;
		}
		
		public static MessageSort getEnumValue(Integer value){
			switch(value){
			case 0:
				return FROM;
			case 1:
				return RECEIVED;
			case 2:
				return SUBJECT;
			case 3: 
				return TYPE;
			default:
				break;
			}
			return null;
		}
		
		public Integer getValue(){
			return this.value;
		}
	}
	
	public enum OrderType{
		ASC(1),
		DESC(2);
		
		private final Integer value;
		
		public static OrderType getEnumValue(int value){
			switch(value){
				case 1:
					return ASC;
				case 2:
					return DESC;
				default:
					break;
			}
			return null;
		}
		
		private OrderType(Integer value){
			this.value = value;
		}
		
		public Integer getValue(){
			return this.value;
		}
	}
	
}
